package com.neuedu.yyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neuedu.yyzx.mapper.CustomerMapper;
import com.neuedu.yyzx.po.Customer;
import com.neuedu.yyzx.dto.CustomerNurseSetDTO;
import com.neuedu.yyzx.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
        implements CustomerService {

    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public Page<CustomerNurseSetDTO> pageWithDetails(Page<CustomerNurseSetDTO> page, LambdaQueryWrapper<Customer> queryWrapper) {
        IPage<CustomerNurseSetDTO> result = customerMapper.pageWithDetails(page, queryWrapper);
        // 确保泛型一致
        Page<CustomerNurseSetDTO> newPage = new Page<>(result.getCurrent(), result.getSize(), result.getTotal());
        newPage.setRecords(result.getRecords());
        return newPage;
    }
}